//
//  SquarePostsDetailsReplylTableViewCell.m
//  安好
//
//  Created by rlp on 14-11-21.
//  Copyright (c) 2014年 lianchuangbrother. All rights reserved.
//

#import "SquarePostsDetailsReplylTableViewCell.h"

@implementation SquarePostsDetailsReplylTableViewCell

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}
-(id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self)
    {
        
//        [self loadheaderCell];
        
    }
    return self;
}
-(void)loadheaderData:(NSString *)dataStr nameA:(NSString *)nameA nameB:(NSString *)nameB{
    

    
    
    NSString *contentStr =[NSString stringWithFormat:@"%@",dataStr];
    // contentStr为你要显示的图文字符串
    NSString *str = [HtmlString transformString:contentStr peopleA:nameA peopleB:nameB];
    
    RCLabel*textLabel = [[RCLabel alloc]initWithFrame:CGRectMake(0,4,kScreenWidth-(15+2)*2,0)];
        textLabel.delegate =self;
        textLabel.sizeDelegate = self;
    [textLabel setFont:[UIFont systemFontOfSize:LABEL_FONT_SIZE_CONTENT_13]];
    RCLabelComponentsStructure *componentsDS = [RCLabel extractTextStyle:str];
    textLabel.componentsAndPlainText = componentsDS;
    CGSize optimalSize = [textLabel optimumSize:YES];   //计算图文混排后的高度
    textLabel.frame=CGRectMake(0,textLabel.frame.origin.y,kScreenWidth-(15+2)*2, optimalSize.height);
    textLabel.lineBreakMode =NSLineBreakByCharWrapping;
    textLabel.backgroundColor = [UIColor clearColor];
    textLabel.textColor =[UIColor orangeColor];
    
    textLabel.textColor = TITLE_ARTICLE_CONTENTFONT_COLOR;
    
    [self.contentView addSubview:textLabel];
    
    self.frame = CGRectMake(self.frame.origin.x, self.frame.origin.y, self.frame.size.width, textLabel.frame.size.height+2+2);
    

    
}
#pragma mark: RCLabelDelegate
-(void)RCLabel:(id)RCLabel didSelectLinkWithURL:(NSString *)url
{
    
        MyNSLog("url======%@",url);
}
#pragma mark: RCLabelSizeDelegate

- (void)RCLabel:(id)RCLabel didChangedSize:(CGSize)size{
        MyNSLog("%f,%f",size.width,size.height);
}

//-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
//    UITouch* touch = [touches anyObject];
//    CGPoint  point = [touch locationInView:self];
//    MyNSLog("point = %lf,%lf\n", point.x, point.y);
//    //回复的table的坐标
//    CGPoint arrowPoint = [self convertPoint:point fromView:self.superview];
//    MyNSLog("arrowPoint = %lf,%lf\n", arrowPoint.x, arrowPoint.y);
//    
//    
//    
//    //装回复的table的tableviewcell的坐标
//    CGPoint tabelcellPoint = [self.superview convertPoint:arrowPoint fromView:self.superview.superview];
//    MyNSLog("tabelcellPoint = %lf,%lf\n", tabelcellPoint.x, tabelcellPoint.y);
//    //装回复的table的坐标
//
//    CGPoint tabelPoint = [self.superview.superview convertPoint:point fromView:self.superview.superview.superview];
//    MyNSLog("tabelPoint = %lf,%lf\n", tabelPoint.x, tabelPoint.y);
//    
//    
//}

@end
